package com.yimi.yinhepda.adapter.RecycleAdapter

import android.content.Context
import android.widget.CheckBox
import com.yimi.yinhepda.R
import com.pda.ym.base.CommonRecycleAdapter
import com.pda.ym.base.CommonViewHolder
import com.pda.ym.entity.bean.LoadBillTaskEntity

/**
 * @author: lj
 * Date: 2020/3/9 14:28
 * Description:装卸组选择配载单适配器
 */
class SelectStowageNoAdapter(var loadType:Int,var context: Context?, dataList: MutableList<LoadBillTaskEntity>?,
                             var commonClickListener: CommonViewHolder.onItemCommonClickListener?)
    : CommonRecycleAdapter<LoadBillTaskEntity>(context, dataList, R.layout.adapter_select_stowage_no_item) {

    override fun bindData(holder: CommonViewHolder?, data: LoadBillTaskEntity?, position: Int) {
        holder?.setCommonClickListener(commonClickListener)
        holder?.setText(R.id.tv_stowageNo, data?.stowageNo)
        if (loadType==1||loadType==10){ //装车 融合装车
            holder?.setText(R.id.tv_prevStation, data?.destDeptName)
        }else if(loadType==2||loadType==11){ //卸车
            holder?.setText(R.id.tv_prevStation, data?.srcDeptName)
        }

        val checkBox = holder?.getView<CheckBox>(R.id.cb_check)
        checkBox?.isChecked = data!!.isCheck
    }
}